Socket
Socket
Sign inDemoInstall

@stdlib/process-read-stdin

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/process-read-stdin

Read data from stdin.


Version published
Weekly downloads
391K
increased by0.34%
Maintainers
4
Weekly downloads
 
Created

What is @stdlib/process-read-stdin?

@stdlib/process-read-stdin is a Node.js package that provides utilities for reading from the standard input (stdin) stream. It is particularly useful for command-line applications and scripts that need to process input provided by the user or piped from other commands.

What are @stdlib/process-read-stdin's main functionalities?

Read Entire Input

This feature allows you to read the entire input from stdin at once. The callback function receives any error that occurred and the data read from stdin.

const stdin = require('@stdlib/process-read-stdin');

stdin(function (error, data) {
  if (error) {
    console.error('Error reading stdin:', error);
    return;
  }
  console.log('Data:', data.toString());
});

Read Input Line by Line

This feature allows you to read the input from stdin and process it line by line. The input data is split into lines, and each line is processed individually.

const stdin = require('@stdlib/process-read-stdin');

stdin(function (error, data) {
  if (error) {
    console.error('Error reading stdin:', error);
    return;
  }
  const lines = data.toString().split('\n');
  lines.forEach((line, index) => {
    console.log(`Line ${index + 1}: ${line}`);
  });
});

Other packages similar to @stdlib/process-read-stdin

Keywords

FAQs

Package last updated on 16 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc